package com.hghivln.erpwarehouse.system.common.lang;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author hl
 * @since 2021-05-20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TreeNode {

    private Integer id;
    @JsonProperty("parentId")
    private Integer pid;
    private String title;
    private String icon;
    private String href;
    private Boolean spread;
    private String target;
    private String typecode;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeNode> child = new ArrayList<>();

    //private String checkArr = "0"; // 0代表不选中  1代表选中

    /**
     * 首页左边导航菜单的构造器
     */
    public TreeNode(Integer id, Integer pid, String title, String icon, String href, Boolean spread, String target, String typecode) {
        this.id = id;
        this.pid = pid;
        this.title = title;
        this.icon = icon;
        this.href = href;
        this.spread = spread;
        this.target = target;
        this.typecode = typecode;
    }

    /**
     * detree的数据格式
     */
    //public TreeNode(Integer id, Integer pid, String title, Boolean spread) {
    //    this.id = id;
    //    this.pid = pid;
    //    this.title = title;
    //    this.spread = spread;
    //}
    //
    //public TreeNode(Integer id, Integer pid, String title, Boolean spread, String checkArr) {
    //    this.id = id;
    //    this.pid = pid;
    //    this.title = title;
    //    this.spread = spread;
    //    this.checkArr = checkArr;
    //}
}
